#include <iostream>
#include "json/json.h"
#include "protocol.hpp"
#include <string.h>
#include <string>

int main()
{
    Json::Value root;
    request_t rq;
    memset(&rq, 0, sizeof(rq));
    rq.x = 10;
    rq.y = 20;
    rq.op = '+';
    root["x"] = rq.x;
    root["y"] = rq.y;
    root["op"] = rq.op;

    //Json::FastWriter writer;
    Json::StyledWriter writer;
    std::string s = writer.write(root);
    std::cout << s << std::endl; 

    // std::string s = R"({"op":43,"x":10,"y":20})";
    // Json::Reader reader;
    // Json::Value root;
    // reader.parse(s, root);
    
    // request_t rq;
    // rq.x = root["x"].asInt();
    // rq.y = root["y"].asInt();
    // rq.op = root["op"].asInt();
    
    // std::cout << "rq.x : " << rq.x << std::endl; 
    // std::cout << "rq.y : " << rq.y << std::endl; 
    // std::cout << "rq.op : " << rq.op << std::endl; 

    return 0;
}